//
//  SearchTableviewCell.m
//  Zaker
//
//  Created by lirui on 16/3/18.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SearchTableviewCell.h"

@interface SearchTableviewCell ()<UIWebViewDelegate>

@end
@implementation SearchTableviewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleWeb = [[UIWebView alloc]init];
        _titleWeb.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleWeb];
        _titleWeb.delegate = self;
        
        self.detailWeb = [[UIWebView alloc]init];
        _detailWeb.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_detailWeb];
      
        _detailWeb.delegate = self;
        
        self.pictureWeb = [[UIWebView alloc]init];
        _pictureWeb.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_pictureWeb];
      
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    _titleWeb.frame = CGRectMake(10, 20, self.contentView.frame.size.width / 4 * 3, (self.contentView.frame.size.height - 20) / 2);
    _titleWeb.scrollView.scrollEnabled = NO;
    _titleWeb.backgroundColor = [UIColor clearColor];
    
    
    _detailWeb.frame = CGRectMake(10, _titleWeb.frame.origin.y + _titleWeb.frame.size.height + 5, _titleWeb.frame.size.width, self.contentView.frame.size.height - 20 - _titleWeb.frame.size.height - 5);
    _detailWeb.scrollView.scrollEnabled = NO;
    _detailWeb.backgroundColor = [UIColor clearColor];
    
    
    _pictureWeb.frame = CGRectMake(_titleWeb.frame.origin.x + _titleWeb.frame.size.width + 5, _titleWeb.frame.origin.y, self.contentView.frame.size.width - 20 - _titleWeb.frame.size.width - 5, self.contentView.frame.size.height - 20);
    _pictureWeb.scrollView.scrollEnabled = NO;
    _pictureWeb.backgroundColor = [UIColor clearColor];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    [_titleWeb stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextSizeAdjust= ‘16%‘"];
    [_detailWeb stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextSizeAdjust= ‘5%‘"];
}

@end
